package com.iplant.ams.service;

import com.iplant.ams.service.po.ams.*;
import com.iplant.ams.service.po.ams.asset.AMSAssetClassification;
import com.iplant.ams.service.po.ams.asset.AMSAssetInfo;
import com.iplant.ams.service.po.ams.asset.AMSAssetStorage;
import com.iplant.ams.service.po.ams.fxt.DMSFrockLedger;
import com.iplant.base.po.Pagination;
import com.iplant.base.po.ServiceResult;
import com.iplant.base.po.excel.ExcelData;
import com.iplant.basic.service.po.bms.BMSEmployee;

import java.util.Calendar;
import java.util.List;

public interface AMSService {

    //region 供应商信息

    /**
     * 新增或修改供应商信息
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdateSupplierInfo(BMSEmployee wLoginUser, AMSSupplierInfo wItem);

    /**
     * 批量导入供应商信息
     *
     * @param wLoginUser
     * @param wItemList
     * @return
     */
    ServiceResult<Integer> AMS_ImportSupplierInfoList(BMSEmployee wLoginUser, List<AMSSupplierInfo> wItemList);

    /**
     * 删除单条供应商信息
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeleteSupplierInfo(BMSEmployee wLoginUser, AMSSupplierInfo wItem);

    /**
     * 批量删除供应商信息
     *
     * @param wLoginUser
     * @param wIDList
     * @return
     */
    ServiceResult<Integer> AMS_DeleteSupplierInfoList(BMSEmployee wLoginUser, List<Integer> wIDList);

    /**
     * 条件查询供应商信息
     *
     * @param wLoginUser
     * @param wIDs
     * @param wName
     * @param wCode
     * @param wCreatorID
     * @param wActive
     * @param wContactName
     * @param wContactNumber
     * @param wOpeningBank
     * @param wPaymentAccount
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSSupplierInfo>> AMS_GetAMSSupplierInfoList(
            BMSEmployee wLoginUser, List<Integer> wIDs, String wName, String wCode, int wCreatorID, int wActive,
            String wContactName, String wContactNumber, String wOpeningBank, String wPaymentAccount,
            Calendar wStartTime, Calendar wEndTime, Pagination wPagination);
    //endregion

    //region 采购申请单

    /**
     * 新增或修改采购申请单
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdatePurchaseRequest(BMSEmployee wLoginUser, AMSPurchaseRequest wItem);

    /**
     * 单条采购申请单删除
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseRequest(BMSEmployee wLoginUser, AMSPurchaseRequest wItem);

    /**
     * 批量删除采购申请单
     *
     * @param wLoginUser
     * @param wIDList
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseRequestList(BMSEmployee wLoginUser, List<Integer> wIDList);

    /**
     * 条件查询采购申请单
     *
     * @param wLoginUser
     * @param wStateIDList
     * @param wActive
     * @param wReceiverName
     * @param wReceiverPhone
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSPurchaseRequest>> AMS_GetPurchaseRequestList(BMSEmployee wLoginUser,
                                                                       List<Integer> wIDList,
                                                                       List<Integer> wStateIDList, Integer wActive,
                                                                       String wReceiverName, String wReceiverPhone,
                                                                       Calendar wStartTime, Calendar wEndTime,
                                                                       Pagination wPagination);
    //endregion

    //region 采购申请单物品详情

    /**
     * 新增或修改采购物品详情
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdatePurchaseRequestItem(BMSEmployee wLoginUser, AMSPurchaseRequestItem wItem);

    /**
     * 删除单条采购物品
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseRequestItem(BMSEmployee wLoginUser, AMSPurchaseRequestItem wItem);

    /**
     * 批量删除采购详细内容
     *
     * @param wLoginUser
     * @param wIDList
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseRequestItemList(BMSEmployee wLoginUser, List<Integer> wIDList);

    /**
     * 条件查询采购详细内容
     *
     * @param wLoginUser
     * @param wRequestID
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSPurchaseRequestItem>> AMS_GetPurchaseRequestItemList(BMSEmployee wLoginUser,
                                                                               int wRequestID, Calendar wStartTime,
                                                                               Calendar wEndTime,
                                                                               Pagination wPagination);

    ServiceResult<List<AMSPurchaseRequestItem>> AMS_GetPurchaseRequestItemListNew(BMSEmployee wLoginUser,
                                                                                  int wRequestID,
                                                                                  Pagination wPagination);
    //endregion

    //region 采购订单

    /**
     * 新增或修改采购订单
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdatePurchaseOrder(BMSEmployee wLoginUser, AMSPurchaseOrder wItem);

    /**
     * 删除单条采购订单
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseOrder(BMSEmployee wLoginUser, AMSPurchaseOrder wItem);

    /**
     * 批量删除采购订单
     *
     * @param wLoginUser
     * @param wIDList
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseOrderList(BMSEmployee wLoginUser, List<Integer> wIDList);

    /**
     * 条件查询采购订单
     *
     * @param wLoginUser
     * @param wIDList
     * @param wStateIDList
     * @param wActive
     * @param wSupplierID
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSPurchaseOrder>> AMS_GetPurchaseOrderList(BMSEmployee wLoginUser,
                                                                   List<Integer> wIDList, String wName, String wCode,
                                                                   Integer wCreatorID, List<Integer> wStateIDList,
                                                                   Integer wActive, Integer wSupplierID,
                                                                   Calendar wStartTime, Calendar wEndTime,
                                                                   Pagination wPagination);

    //endregion

    //region 采购订单物品详细

    /**
     * 新增或修改采购订单项
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdatePurchaseOrderItem(BMSEmployee wLoginUser, AMSPurchaseOrderItem wItem);

    /**
     * 删除单条采购订单项
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseOrderItem(BMSEmployee wLoginUser, AMSPurchaseOrderItem wItem);

    /**
     * 批量删除采购订单项
     *
     * @param wLoginUser
     * @param wItemList
     * @return
     */
    ServiceResult<Integer> AMS_DeletePurchaseOrderItemList(BMSEmployee wLoginUser,
                                                           List<AMSPurchaseOrderItem> wItemList);

    /**
     * 条件查询采购订单项
     *
     * @param wLoginUser
     * @param wOrderID
     * @param wPurchaseRequestItemID
     * @param wAssetStandardModelID
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSPurchaseOrderItem>> AMS_GetPurchaseOrderItemList(BMSEmployee wLoginUser,
                                                                           List<Integer> wIDList, int wOrderID,
                                                                           int wPurchaseRequestItemID,
                                                                           int wAssetStandardModelID,
                                                                           Calendar wStartTime, Calendar wEndTime,
                                                                           Pagination wPagination);

    /**
     * 幺式注解法查询某采购订单下的订单项集合
     *
     * @param wLoginUser
     * @param wOrderID
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSPurchaseOrderItem>> AMS_GetPurchaseOrderItemListNew(
            BMSEmployee wLoginUser, int wOrderID,
            Calendar wStartTime, Calendar wEndTime, Pagination wPagination);
    //endregion

    //region 收货单

    /**
     * 新增或修改收货单
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdateReceiveGoods(BMSEmployee wLoginUser, AMSReceiveGoods wItem);

    /**
     * 删除单条收货单
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeleteReceiveGoods(BMSEmployee wLoginUser, AMSReceiveGoods wItem);

    /**
     * 批量删除收货单
     *
     * @param wLoginUser
     * @param wIDList
     * @return
     */
    ServiceResult<Integer> AMS_DeleteReceiveGoodsList(BMSEmployee wLoginUser, List<Integer> wIDList);

    /**
     * 条件查询收货单
     *
     * @param wLoginUser
     * @param wIDList
     * @param wName
     * @param wCode
     * @param wCreatorID
     * @param wStateIDList
     * @param wActive
     * @param wOrderID
     * @param wSupplierID
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSReceiveGoods>> AMS_GetReceiveGoodsList(BMSEmployee wLoginUser,
                                                                 List<Integer> wIDList, String wName, String wCode,
                                                                 Integer wCreatorID, List<Integer> wStateIDList,
                                                                 Integer wActive, Integer wOrderID, Integer wSupplierID,
                                                                 Calendar wStartTime, Calendar wEndTime,
                                                                 Pagination wPagination);
    //endregion

    //region 收货单物品详情

    /**
     * 新增或修改收货单详情项
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdateReceiveGoodsItem(BMSEmployee wLoginUser, AMSReceiveGoodsItem wItem);

    /**
     * 删除单条收货单详情
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeleteReceiveGoodsItem(BMSEmployee wLoginUser, AMSReceiveGoodsItem wItem);

    /**
     * 批量删除收货单详情
     *
     * @param wLoginUser
     * @param wItemList
     * @return
     */
    ServiceResult<Integer> AMS_DeleteReceiveGoodsItemList(BMSEmployee wLoginUser, List<AMSReceiveGoodsItem> wItemList);

    /**
     * 条件查询收货单详情
     *
     * @param wLoginUser
     * @param wReceiveID
     * @param wOrderItemID
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSReceiveGoodsItem>> AMS_GetAMSReceiveGoodsItemList(BMSEmployee wLoginUser,
                                                                            int wReceiveID, int wOrderItemID,
                                                                            List<Integer> wStateList, int wCreatorID,
                                                                            Calendar wStartTime, Calendar wEndTime,
                                                                            Pagination wPagination);
    //endregion

    //region 资产入库单

    /**
     * 新增或修改入库单
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdateAssetStorage(BMSEmployee wLoginUser, AMSAssetStorage wItem);

    /**
     * 删除单条入库单
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeleteAssetStorage(BMSEmployee wLoginUser, AMSAssetStorage wItem);

    /**
     * 批量删除入库单
     *
     * @param wLoginUser
     * @param wIDList
     * @return
     */
    ServiceResult<Integer> AMS_DeleteAssetStorageList(BMSEmployee wLoginUser, List<Integer> wIDList);

    /**
     * 条件查询入库单
     *
     * @param wLoginUser
     * @param wIDs
     * @param wName
     * @param wCode
     * @param wCreatorID
     * @param wActive
     * @param wReceiveReceiptID
     * @param wSupplierID
     * @param wSourceID
     * @param wStateIDList
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSAssetStorage>> AMS_GetAssetStorageList(BMSEmployee wLoginUser,
                                                                 List<Integer> wIDs, String wName, String wCode,
                                                                 int wCreatorID, int wActive,
                                                                 Integer wReceiveReceiptID, Integer wSupplierID,
                                                                 Integer wSourceID, List<Integer> wStateIDList,
                                                                 Calendar wStartTime, Calendar wEndTime,
                                                                 Pagination wPagination);

    //endregion

    //region 资产列表

    /**
     * 新增或修改单条资产
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_UpdateAssetInfo(BMSEmployee wLoginUser, AMSAssetInfo wItem);

    /**
     * 删除单条资产
     *
     * @param wLoginUser
     * @param wItem
     * @return
     */
    ServiceResult<Integer> AMS_DeleteAssetInfo(BMSEmployee wLoginUser, AMSAssetInfo wItem);

    /**
     * 批量删除资产
     *
     * @param wLoginUser
     * @param wIDList
     * @return
     */
    ServiceResult<Integer> AMS_DeleteAssetInfoList(BMSEmployee wLoginUser, List<Integer> wIDList);

    /**
     * 条件查询资产列表
     *
     * @param wLoginUser
     * @param wIDs
     * @param wName
     * @param wCode
     * @param wCreatorID
     * @param wActive
     * @param wStateIDList
     * @param wStandardModelID
     * @param wAssetSN
     * @param wStorageID
     * @param wKeepInUserID
     * @param wKeepInUserName
     * @param wStartTime
     * @param wEndTime
     * @param wPagination
     * @return
     */
    ServiceResult<List<AMSAssetInfo>> AMS_GetAssetInfoList(BMSEmployee wLoginUser,
                                                           List<Integer> wIDs, String wName, String wCode,
                                                           int wCreatorID, int wActive, List<Integer> wStateIDList,
                                                           int wStandardModelID, String wAssetSN, int wStorageID,
                                                           int wKeepInUserID, String wKeepInUserName,
                                                           Calendar wStartTime, Calendar wEndTime,
                                                           Pagination wPagination);

    ServiceResult<AMSAssetClassification> AMS_QueryAssetClassification(BMSEmployee wLoginUser, int wID);

    ServiceResult<Integer> AMS_InitAssetClassification(BMSEmployee wLoginUser);

    ServiceResult<List<AMSAssetClassification>> AMS_QueryAssetClassificationList(BMSEmployee wLoginUser, String wName
            , String wCode, int wParentID, Calendar wStartTime, Calendar wEndTime, int wActive, Pagination wPagination);

    ServiceResult<Integer> AMS_UpdateAssetClassification(BMSEmployee wLoginUser,
                                                         AMSAssetClassification wAMSAssetClassification);

    ServiceResult<Integer> AMS_ActiveAssetClassificationList(BMSEmployee wLoginUser,
                                                             List<AMSAssetClassification> wAMSAssetClassificationList
            , int wActive);

    ServiceResult<Integer> AMS_AssetClassificationDeleteList(BMSEmployee wLoginUser, List<AMSAssetClassification> wDataList);
    //endregion

    //region 工装/量器具管理
    void AMS_InitFrockTool(BMSEmployee wLoginUser);

    void AMS_InitMeasureTool(BMSEmployee sysAdmin);

    ServiceResult<DMSFrockLedger> DMS_QueryFrockLedgerByCode(BMSEmployee wLoginUser, String wCode);
    //endregion

    //region 工装台账
    ServiceResult<Integer> DMS_UpdateFrockLedger(BMSEmployee wLoginUser, DMSFrockLedger wDMSFrockLedger);

    ServiceResult<Integer> DMS_ImportFrockLedger(BMSEmployee wLoginUser, ExcelData result);

    //endregion
}
